package com.bwie.controller;
import com.bwie.pojo.User;
import com.bwie.service.UserService;
import com.bwie.service.impl.UserServiceImpl;
import com.bwie.utils.R;
import com.bwie.vo.LoginVo;
import com.bwie.vo.PageInfoVo;
import com.bwie.vo.ReginInfoVo;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import org.springframework.beans.factory.annotation.Autowired;

/**
* 用户表(tb_user)表控制层
*
* @author xxxxx
*/
@RestController
@RequestMapping("/user/user")
public class UserController {
/**
* 服务对象
*/
    @Autowired
    private UserService userService;

    @ApiOperation("发送验证码")
    @PostMapping("/sendCode/{mobile}")
    public R sendCode(@PathVariable("mobile") String mobile){
        return userService.sendCode(mobile);
    }

    @ApiOperation("登录")
    @PostMapping("/login")
    public R login(@RequestBody @Validated LoginVo loginVo){
        return userService.login(loginVo);
    }

    @ApiOperation("注册")
    @PostMapping("/userRegister")
    public R userRegister(@RequestBody @Validated ReginInfoVo reginInfoVo){
        return userService.userRegister(reginInfoVo);
    }

    @ApiOperation("树型菜单")
    @PostMapping("/menuList")
    public R menuList(){
        return userService.menuList();
    }

    @ApiOperation("用户列表")
    @PostMapping("/userList")
    public R userList(@RequestBody PageInfoVo pageInfoVo){
        return userService.userList(pageInfoVo);
    }

}
